int rob(int* nums, int numsSize) {
    int ans = 0;
    if(numsSize==1)return nums[0];
    if(numsSize==2)return fmax(nums[0],nums[1]);
    if(numsSize==3){
        ans = fmax(nums[0]+nums[2],nums[1]);
        return ans;
    }
    int dp[numsSize];
    dp[0] = nums[0];
    dp[1] = nums[1];
    dp[2] = nums[0]+nums[2];
    for(int i=3;i<numsSize;i++){
        dp[i] = fmax(dp[i-2]+nums[i],dp[i-3]+nums[i]);
    }
    ans = fmax(dp[numsSize-1],dp[numsSize-2]);
    return ans;
}